import request from '@/utils/request'

//注册的方法
export function registerMember(userInfo) {
    return request({
        url: '/user/front_member/register',
        method: 'post',
        data: userInfo
    })
}


//登录的方法
export function submitLoginUser(userInfo) {
    return request({
        url: '/user/front_member/login',
        method: 'post',
        data: userInfo
    })
}

//根据token获取用户信息
export function getLoginUserInfo() {
    return request({
        url: '/user/front_member/getMemberInfo',
        method: 'get'
    })
}

// 修改用户资料
export function editUserInfo(userInfo) {
    return request({
        url: '/user/front_member',
        method: 'put',
        data: userInfo
    })
}

// 修改密码
export function editPwd(id, oldPwd, newPwd) {
    return request({
        url: '/user/front_member/pwd',
        method: 'put',
        data: {
            id: id,
            oldPwd: oldPwd,
            newPwd: newPwd
        }
    })
}